angular.module('freshfruit',[])
.config(['$routeProvider',function($routeProvider){
	$routeProvider
	.when('/freshfruit',{
		templateUrl:'html/freshfruit/freshfruit.html',
		css:'html/freshfruit/freshfruit.css'
	})
}])
.controller('freshfruitCtrl',function($scope,$http,$rootScope){
	$(".shop_menu>ul>li>a").on('click',function(){
		$(".shop_menu>ul>li>a").css("color","white").css("background","black")
		$(".shop_menu>ul").css("background","black")
		$(this).css("background","white").css("color","black")
		
	});
	$('.first_li').click(function(){
		$(".right").hide()
		$(".home_page").show()
	});
	//水果
	$('.fruit').click(function(){
		$(".right").hide()
		$(".right_fruit").show()
	})
	//副食
	$('.fushi_li').click(function(){
		$(".right").hide()
		$(".fushi").show()
	})
	
	
	$('.all_li').click(function(){
		$(".right").hide()
		$(".all").show()
	})
	
	$scope.arr=[{
		"imgs":'http://pic4.taocz.cn/store_1690/goods/20150124/middle_201501241357298532.jpg',
		"num":'1',
		"price":'￥19.9',
		"names":'楼口生鲜 新鲜 齐峰猕猴桃 27枚/板 新鲜水果'
	},
	{
		"imgs":'http://pic4.taocz.cn/store_1690/goods/20141217/middle_201412170928226538.jpg',
		"num":'2',
		"price":'￥14.6',
		"names":'海底捞上汤三鲜火锅底料200g'
	},
	{
		"imgs":'http://pic2.taocz.cn/store_1690/goods/20141217/middle_201412170931498241.jpg',
		"num":'3',
		"price":'￥14.6',
		"names":'海底捞番茄火锅底料 200g'
	},
	{
		"imgs":'http://pic5.taocz.cn/store_1690/goods/20141217/middle_201412170934595867.jpg',
		"num":'4',
		"price":'￥15.3',
		"names":'海底捞清汤火锅汤料110g'
	},{
		"imgs":'http://pic20.taocz.cn/store_4087/goods/20161218/middle_201612181811477365.jpg',
		"num":'5',
		"price":'￥35.0',
		"names":'大凉山丑苹果 7斤礼盒'
	}];
	
	
	$http.get("http://www.yanhanbo.top/user/goods.php?names=&imgs=&standard=&genre=&delivery=&price=&type=%E6%89%80%E6%9C%89").then(function(data){
		$scope.data=data.data.data;
		console.log()
	 $scope.arrxiao=$scope.data.slice(0,5)
	  $scope.fushi=$scope.data.slice(0,2)
	 
		console.log($scope.arrxiao)
		
		
	})
//	第二个数据
//	$scope.arr1=[{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161218/middle_201612181609317103.jpg.350x350.jpg",
//		"name":"(金坛特产)纯手工红薯山芋粉丝5斤装",
//		"price":"￥45.0"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161220/middle_201612201627176957.jpg.350x350.jpg",
//		"name":"安卡拉螺旋意面500克",
//		"price":"￥9.8"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161220/middle_201612201623555513.jpg.350x350.jpg",	
//		"name":"疯台味关庙面（家常宽面）",
//		"price":"￥15.8"
//	},{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161220/middle_201612201627508614.jpg.350x350.jpg",
//		"name":"(土耳其进口)安卡拉细长意面 500g/袋",
//		"price":"￥9.8"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161220/middle_201612201218222776.jpg.350x350.jpg",
//		"name":"疯台味关庙面（手打拉面）",
//		"price":"￥15.8"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161219/middle_201612191541275569.png.350x350.jpg",
//		"name":"海底捞110g菌汤火锅汤料",
//		"price":"￥14.6"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161220/middle_201612201648343573.jpg.350x350.jpg",
//		"name":"怀姜糖膏350g",
//		"price":"￥55.8"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20170228/middle_201702281024465967.jpg.350x350.jpg",
//		"name":"川崎火锅调料麻辣味",
//		"price":"￥4.0"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20161220/middle_201612201545253341.png.350x350.jpg",
//		"name":"台竹乡仙草糖70g",
//		"price":"￥13.8"
//	},
//	{
//		"img":"http://pic20.taocz.cn/store_4087/goods/20170228/middle_201702281028415592.jpg.350x350.jpg",
//		"name":"川崎火锅调料海鲜味",
//		"price":"￥4.0"
//	}]

	//头部和底部显示隐藏
	$rootScope.sh = true;

	//点击进入详情页
	$rootScope.arr2 = [];
	$scope.dianji = function(x){
		$rootScope.arr2.push(x);
		localStorage.arrr = JSON.stringify($rootScope.arr2);
	};
	//价格排序
	$scope.price2 = function(){
//		console.log('aaa')
		$scope.data.sort(function(a,b){
			return a.price - b.price;
		})
	}
	$scope.price4 = function(){
		console.log('aaa')
		$scope.data.sort(function(a,b){
			return a.price >b.price;
		})
	};
	

})